package com.nanyang.tms.domain.waybill.context;

import java.io.Serializable;

import com.nanyang.common.core.flow.context.AbsTransHandlerContext;
import com.nanyang.tms.domain.forecast.context.CalculateFreightContext;
import com.nanyang.tms.domain.forecast.context.CalculateWeightContext;

import lombok.Data;
@Data
public class WaybillAddContext  extends AbsTransHandlerContext implements Serializable{

	private static final long serialVersionUID = 1L;
	private CalculateWeightContext calculateWeightContext;
	private CalculateFreightContext calculateFreightContext;
	private SaveWaybillReceiptContext  saveWaybillReceiptContext;
	private UpdateReceiptContext updateReceiptContext;
	private UpdateForecastContext  updateForecastContext;
	private SaveTackInfoContext saveTackInfoContext;
	public WaybillAddContext(){
		this.calculateFreightContext=new CalculateFreightContext();
		this.calculateWeightContext=new CalculateWeightContext();
		this.updateReceiptContext=new UpdateReceiptContext();
		this.saveWaybillReceiptContext=new SaveWaybillReceiptContext();
		this.updateForecastContext=new UpdateForecastContext();
		this.saveTackInfoContext=new SaveTackInfoContext();
	}
	@Override
	public Object getTransHandlerContext(Class<?> cls) {
		if(cls.getSimpleName().equals("CalculateWeightContext")){
			return this.getCalculateWeightContext();
		}
		else if (cls.getSimpleName().equals("CalculateFreightContext")){
			return this.getCalculateFreightContext();
		}
		else if (cls.getSimpleName().equals("UpdateReceiptContext")){
			return this.getUpdateReceiptContext();
		}
		else if (cls.getSimpleName().equals("SaveWaybillReceiptContext")){
			return this.getSaveWaybillReceiptContext();
		}
		else if (cls.getSimpleName().equals("UpdateForecastContext")){
			return this.getUpdateForecastContext();
		}
		else if (cls.getSimpleName().equals("SaveTackInfoContext")){
			return this.getSaveTackInfoContext();
		}
		else{
			throw new RuntimeException("无此属性");
		}
	}

}
